const http = require('http');

const server = http.createServer((req, res) => {
  res.writeHead(404,{'Content-Type':'text/plain; charset=utf-8'})
  res.write('xxx\n');
  res.write('大都都')
  res.end('Hello World!'); // 返回响应
});

server.listen(3000, () => {
  console.log('服务器运行在 http://localhost:3000');
});